{% extends "base.html" %}

{% block title %}{{ block.super }} &bull; Test {{ test.id }} Detail{% endblock %}

{% block extrahead %}
{# <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script> #}
{# locally modified jquery with bfcache hack #}
<script src="{{ MEDIA_URL }}/js/jquery-1.2.6.js" type="text/javascript"></script>

<script type="text/javascript">
$(function() {
    $("iframe.testcontent").hide();
    $("a.show-hide-frame").show().click(function(event) {
        $(this).next().toggle("slow");
        event.preventDefault();
    });
});
</script>
{% endblock %}

{% block content %}

<h2>Test {{ test }} Detail</h2>

<div class="test-detail">
<dl>
    <dt>id</dt>
    <dd>{{ test.id }}</dd>
    <dt>type</dt>
    <dd>{{ test.type }}</dd>
    <dt>version</dt>
    <dd>{{ test.version }}</dd>
    <dt>enabled</dt>
    <dd>{{ test.enabled }}</dd>
    <dt>tags</dt>
    <dd>{{ test.tags.all|join:"," }}</dd>
    <dt>flags</dt>
    <dd>{{ test.flags.all|join:"," }}</dd>
    <dt>sections</dt>
    <dd>
        {% if test.sections.all %}
        <ul>
            {% for section in test.sections.all %}
            <li>
                <a href="{{ section.spec.get_absolute_url }}">
                    {{ section.spec }}</a>
                | {{ section.number }}. {{ section.label }}
            </li>
            {% endfor %}
        </ul>
        {% endif %}
    </dd>
    <dt>url</dt>
    <dd>{{ test.url }}</dd>
    {% if test.file %}
        <dt>file</dt>
        <dd>{{ test.file }}</dd>
    {% endif %}
    {% if test.url2 %}
        <dt>url2</dt>
        <dd>{{ test.url2 }}</dd>
    {% endif %}
    {% if test.file2 %}
        <dt>file2</dt>
        <dd>{{ test.file2 }}</dd>
    {% endif %}
</dl>
</div>

<div class="clear"></div>
<hr/>

<dl>
    <dt>results</dt><dd>
        {% load testtags %}
        {% show_test test %}
    </dd>

    {% ifequal test.type "mochitest" %}
    <h4>Mochitest detail</h4>
    {% endifequal %}

    {% ifequal test.type "layouttest" %}
    <h4>Layouttest detail</h4>
    expected:
    <pre class="code">{{ test.expected_content }}</pre>
    {% endifequal %}

    {% ifequal test.type "reftest" %}
    <h4>Reftest detail</h4>
    <dt>equal</dt><dd>{{ test.equal }}</dd>
    <dt>expected</dt><dd>{{ test.expected }}</dd>
    <dt>failure_type</dt><dd>{{ test.failure_type }}</dd>
    {% endifequal %}

    {% if test.file %}
    file:
    <pre class="code">{{ test.file_content }}</pre>
    <a href="{{ TESTS_URL }}/{{ test.file }}">file frame</a>
    <a href='#' class='show-hide-frame'>show/hide</a>:
    <iframe class="testcontent" src="{{ TESTS_URL }}/{{ test.file }}"></iframe>
    {% endif %}
    <br><br>
    {% if test.file2 %}
    file2:
    <pre class="code">{{ test.file2_content }}</pre>
    <a href="{{ TESTS_URL }}/{{ test.file2 }}">file2 frame</a>
    <a href='#' class='show-hide-frame'>show/hide</a>:
    <iframe class="testcontent" src="{{ TESTS_URL }}/{{ test.file2 }}"></iframe>
    {% endif %}
</dl>

{% endblock %}
